﻿// (c) Copyright slimCODE Software Inc. - www.slimcode.com
// This source is subject to the Microsoft Public License (Ms-PL).
// Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details.
// All other rights reserved.

using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;

namespace SlimCode.SlimPasswords
{
  internal static class ImageCache
  {
    #region ApplicationIcon STATIC PROPERTY

    private static Icon mg_applicationIcon;

    public static Icon ApplicationIcon
    {
      get 
      {
        if( mg_applicationIcon == null )
        {
          mg_applicationIcon = Resources.ApplicationIcon;
        }

        return mg_applicationIcon; 
      }
    }

    #endregion

    #region ApplicationImage STATIC PROPERTY

    private static Image mg_applicationImage;

    public static Image ApplicationImage
    {
      get
      {
        if( mg_applicationImage == null )
        {
          mg_applicationImage = Resources.ApplicationImage;
        }

        return mg_applicationImage;
      }
    }

    #endregion

    #region Bubble STATIC PROPERTY

    private static Image mg_bubble;

    public static Image Bubble
    {
      get
      {
        if( mg_bubble == null )
        {
          mg_bubble = Resources.BubbleDark;
        }

        return mg_bubble;
      }
    }

    #endregion

    #region BubbleFocused STATIC PROPERTY

    private static Image mg_bubbleFocused;

    public static Image BubbleFocused
    {
      get
      {
        if( mg_bubbleFocused == null )
        {
          mg_bubbleFocused = Resources.BubbleGlass;
        }

        return mg_bubbleFocused;
      }
    }

    #endregion

    #region BubblePressed STATIC PROPERTY

    private static Image mg_bubblePressed;

    public static Image BubblePressed
    {
      get
      {
        if( mg_bubblePressed == null )
        {
          mg_bubblePressed = Resources.Bubble;
        }

        return mg_bubblePressed;
      }
    }

    #endregion

    #region BubbleSelected STATIC PROPERTY

    private static Image mg_bubbleSelected;

    public static Image BubbleSelected
    {
      get
      {
        if( mg_bubbleSelected == null )
        {
          mg_bubbleSelected = Resources.BubbleDarkGlass;
        }

        return mg_bubbleSelected;
      }
    }

    #endregion

    #region Button STATIC PROPERTY

    private static Image mg_button;

    public static Image Button
    {
      get 
      {
        if( mg_button == null )
        {
          mg_button = Resources.Button;
        }

        return mg_button; 
      }
    }

    #endregion

    #region ButtonFocused STATIC PROPERTY

    private static Image mg_buttonFocused;

    public static Image ButtonFocused
    {
      get
      {
        if( mg_buttonFocused == null )
        {
          mg_buttonFocused = Resources.ButtonFocused;
        }

        return mg_buttonFocused;
      }
    }

    #endregion

    #region ButtonPressed STATIC PROPERTY

    private static Image mg_buttonPressed;

    public static Image ButtonPressed
    {
      get
      {
        if( mg_buttonPressed == null )
        {
          mg_buttonPressed = Resources.ButtonPressed;
        }

        return mg_buttonPressed;
      }
    }

    #endregion

    #region Checked STATIC PROPERTY

    private static Image mg_checked;

    public static Image Checked
    {
      get 
      {
        if( mg_checked == null )
        {
          mg_checked = Resources.Checked40;
        }

        return mg_checked; 
      }
    }

    #endregion

    #region GetCloseImage STATIC METHOD

    private static Image mg_close24;
    private static Image mg_close36;

    public static Image GetCloseImage( int maxHeight )
    {
      if( maxHeight >= 36 )
      {
        if( mg_close36 == null )
        {
          mg_close36 = Resources.Close36;
        }

        return mg_close36;
      }

      System.Diagnostics.Debug.WriteIf( maxHeight < 24, "Maximum height for Close icon is too small." );

      if( mg_close24 == null )
      {
        mg_close24 = Resources.Close24;
      }

      return mg_close24;
    }

    #endregion

    #region GetDecrementImage STATIC METHOD

    private static Image mg_decrement20;
    private static Image mg_decrement30;

    public static Image GetDecrementImage( int maxHeight )
    {
      if( maxHeight >= 30 )
      {
        if( mg_decrement30 == null )
        {
          mg_decrement30 = Resources.Minus30;
        }

        return mg_decrement30;
      }

      System.Diagnostics.Debug.WriteIf( maxHeight < 20, "Maximum height for image is too small." );

      if( mg_decrement20 == null )
      {
        mg_decrement20 = Resources.Minus20;
      }

      return mg_decrement20;
    }

    #endregion

    #region GetFileImage STATIC METHOD

    private static Image mg_file20;
    private static Image mg_file30;

    public static Image GetFileImage( int maxHeight )
    {
      if( maxHeight >= 30 )
      {
        if( mg_file30 == null )
        {
          mg_file30 = Resources.File30;
        }

        return mg_file30;
      }

      System.Diagnostics.Debug.WriteIf( maxHeight < 20, "Maximum height for File icon is too small." );

      if( mg_file20 == null )
      {
        mg_file20 = Resources.File20;
      }

      return mg_file20;
    }

    #endregion

    #region GetFolderImage STATIC METHOD

    private static Image mg_folder20;
    private static Image mg_folder30;

    public static Image GetFolderImage( int maxHeight )
    {
      if( maxHeight >= 30 )
      {
        if( mg_folder30 == null )
        {
          mg_folder30 = Resources.Folder30;
        }

        return mg_folder30;
      }

      System.Diagnostics.Debug.WriteIf( maxHeight < 20, "Maximum height for Folder icon is too small." );

      if( mg_folder20 == null )
      {
        mg_folder20 = Resources.Folder20;
      }

      return mg_folder20;
    }

    #endregion

    #region GetIncrementImage STATIC METHOD

    private static Image mg_increment20;
    private static Image mg_increment30;

    public static Image GetIncrementImage( int maxHeight )
    {
      if( maxHeight >= 30 )
      {
        if( mg_increment30 == null )
        {
          mg_increment30 = Resources.Plus30;
        }

        return mg_increment30;
      }

      System.Diagnostics.Debug.WriteIf( maxHeight < 20, "Maximum height for image is too small." );

      if( mg_increment20 == null )
      {
        mg_increment20 = Resources.Plus20;
      }

      return mg_increment20;
    }

    #endregion

    #region GetParentFolderImage STATIC METHOD

    private static Image mg_parentFolder20;
    private static Image mg_parentFolder30;

    public static Image GetParentFolderImage( int maxHeight )
    {
      if( maxHeight >= 30 )
      {
        if( mg_parentFolder30 == null )
        {
          mg_parentFolder30 = Resources.ParentFolder30;
        }

        return mg_parentFolder30;
      }

      System.Diagnostics.Debug.WriteIf( maxHeight < 20, "Maximum height for ParentFolder icon is too small." );

      if( mg_parentFolder20 == null )
      {
        mg_parentFolder20 = Resources.ParentFolder20;
      }

      return mg_parentFolder20;
    }

    #endregion

    #region GetPasswordFileImage STATIC METHOD

    private static Image mg_passwordFile20;
    private static Image mg_passwordFile30;

    public static Image GetPasswordFileImage( int maxHeight )
    {
      if( maxHeight >= 30 )
      {
        if( mg_passwordFile30 == null )
        {
          mg_passwordFile30 = Resources.PasswordStoreFile30;
        }

        return mg_passwordFile30;
      }

      System.Diagnostics.Debug.WriteIf( maxHeight < 20, "Maximum height for PasswordFile icon is too small." );

      if( mg_passwordFile20 == null )
      {
        mg_passwordFile20 = Resources.PasswordStoreFile20;
      }

      return mg_passwordFile20;
    }

    #endregion

    #region Popup STATIC PROPERTY

    private static Image mg_popup;

    public static Image Popup
    {
      get
      {
        if( mg_popup == null )
        {
          mg_popup = Resources.Popup;
        }

        return mg_popup;
      }
    }

    #endregion

    #region ScrollThumb STATIC PROPERTY

    private static Image mg_scrollThumb;

    public static Image ScrollThumb
    {
      get 
      {
        if( mg_scrollThumb == null )
        {
          mg_scrollThumb = Resources.Mosaik;
        }

        return mg_scrollThumb; 
      }
    }

    #endregion

    #region Unchecked STATIC PROPERTY

    private static Image mg_unchecked;

    public static Image Unchecked
    {
      get
      {
        if( mg_unchecked == null )
        {
          mg_unchecked = Resources.Unchecked40;
        }

        return mg_unchecked;
      }
    }

    #endregion
  }
}
